package cn.superchart.module.dev.genconfig.controller;

import cn.superchart.common.base.BaseController;
import cn.superchart.common.base.BaseResult;
import cn.superchart.module.dev.genconfig.param.ScGenTableConfBatchAddParam;
import cn.superchart.module.dev.genconfig.param.ScGenTableConfDetailParam;
import cn.superchart.module.dev.genconfig.param.ScTableConfQueryParam;
import cn.superchart.module.dev.genconfig.service.ScGenTableConfService;
import jakarta.validation.Valid;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Validated
public class ScGenTableConfController extends BaseController<ScGenTableConfService> {



//    @PostMapping("/sc/gen/table/conf/page")
//    public BaseResult<Page<ScGenTableConfDetailParam>> page(@RequestBody @Valid ScGenTableConfPageParam scGenTableConfPageParam) {
//        Page<ScGenTableConfDetailParam> page = service.page(scGenTableConfPageParam);
//        return BaseResult.result(page);
//    }


//    @PostMapping("/sc/gen/table/conf/add")
//    public BaseResult<String> add(@RequestBody @Valid ScGenTableConfAddParam scGenTableConfAddParam) {
//        String rowId= service.add(scGenTableConfAddParam);
//        return BaseResult.result(rowId);
//    }
//
//    @PostMapping("/sc/gen/table/conf/edit")
//    public BaseResult<String> edit(@RequestBody @Valid ScGenTableConfEditParam scGenTableConfEditParam) {
//        service.edit(scGenTableConfEditParam);
//        return BaseResult.ok();
//    }

//    @GetMapping("/sc/gen/table/conf/detail")
//    public BaseResult<ScGenTableConfDetailParam> detail( @Valid ScGenTableConfIdParam scGenTableConfIdParam) {
//        return BaseResult.result(service.detail(scGenTableConfIdParam.getId()));
//    }

    @GetMapping("/sc/gen/table/conf/fieldQuery")
    public BaseResult<List<ScGenTableConfDetailParam>> fieldQuery(@Valid ScTableConfQueryParam scTableConfQueryParam) {
        return BaseResult.result(service.fieldQuery(scTableConfQueryParam));
    }

    @PostMapping("/sc/gen/table/conf/upConf")
    public BaseResult<String> upConf(@RequestBody @Valid ScGenTableConfBatchAddParam scGenTableConfBatchAddParam) {
        service.upConf(scGenTableConfBatchAddParam);
        return BaseResult.ok();
    }



//    @DeleteMapping("/sc/gen/table/conf/delete")
//    public BaseResult<Boolean> delete(@Valid ScGenTableIdParam scGenTableIdParam) {
//        Boolean res = service.delete(scGenTableIdParam.getId());
//        return BaseResult.result(res);
//    }

}
